import turtle as t


# 画圆角矩形函数
def draw_round_rect(start_x, start_y, lt_x, lt_y, rb_x, rb_y, r, pensize, is_fill, fill_color='white'):
    if is_fill:
        t.fillcolor(fill_color)
        t.begin_fill()
    t.pensize(pensize)
    t.penup()
    t.goto(start_x, start_y)
    t.pendown()
    t.goto(rb_x, rb_y)
    t.circle(r, 90)
    t.goto(rb_x + 10, lt_y - 10)
    t.circle(r, 90)
    t.goto(lt_x, lt_y)
    t.circle(r, 90)
    t.goto(lt_x - 10, rb_y + 10)
    t.circle(r, 90)
    t.goto(start_x, start_y)
    t.end_fill()


# 基本设置
t.ht()
screen = t.Screen()
screen.setup(1024, 768)
t.pensize(5)
# 变量初始化
lst_red = [[-390, -310], [-260, -340]]
lst_green = [[-290, -210], [-260, -340]]
lst_blue = [[-190, -110], [-260, -340]]
lst_yellow = [[-90, -10], [-260, -340]]
lst_line = [[10, 90], [-260, -340]]
lst_rect = [[110, 190], [-260, -340]]
lst_circle = [[210, 290], [-260, -340]]
lst_triangle = [[310, 390], [-260, -340]]
# 画颜色和形状区域
draw_round_rect(0, -350, -400, -250, 400, -350, 10, 5, False)
# 画颜色框
draw_round_rect(-350, -340, lst_red[0][0], lst_red[1][0], lst_red[0][1], lst_red[1][1], 10, 3, True, 'red')
draw_round_rect(-250, -340, lst_green[0][0], lst_green[1][0], lst_green[0][1], lst_green[1][1], 10, 3, True, 'green')
draw_round_rect(-150, -340, lst_blue[0][0], lst_blue[1][0], lst_blue[0][1], lst_blue[1][1], 10, 3, True, 'blue')
draw_round_rect(-50, -340, lst_yellow[0][0], lst_yellow[1][0], lst_yellow[0][1], lst_yellow[1][1], 10, 3, True,
                'yellow')
draw_round_rect(50, -340, lst_blue[0][0], lst_blue[1][0], lst_blue[0][1], lst_blue[1][1], 10, 3, True, 'blue')
draw_round_rect(150, -340, lst_blue[0][0], lst_blue[1][0], lst_blue[0][1], lst_blue[1][1], 10, 3, True, 'blue')
draw_round_rect(250, -340, lst_blue[0][0], lst_blue[1][0], lst_blue[0][1], lst_blue[1][1], 10, 3, True, 'blue')
draw_round_rect(350, -340, lst_blue[0][0], lst_blue[1][0], lst_blue[0][1], lst_blue[1][1], 10, 3, True, 'blue')


t.done()
